import math
def cjia(num1,num2):
    return num1+num2
def cjian(num1,num2):
    return num1-num2
def ccheng(num1,num2):
    return num1*num2
def cchu(num1,num2):
    if num2==0:
        print("除数不能为0")
        return 0
    return num1/num2
def cduishu(num1,num2):
    return math.log(num1,num2)
def cchengfang(num1,num2):
    return num1**num2
def cqiuyu(num1,num2):
    return num1%num2
def csanjiao(sanjiao,num):
    if sanjiao == "sin":
        num = math.radians(num)
        print("num的sin值为", format(math.sin(num),'.2f'))
    elif sanjiao == "cos":
        num = math.radians(num)
        print("num的sin值为", format(math.cos(num),'.2f'))

flag =True
while flag:
    yunsuan=input("请问：需要复数（1）吗，还是整数（2）运算,还是三角（3）运算？\n")
    if yunsuan=="1":
        num1=complex(input("请输入一个数："))
        num2=complex(input("请输入另一个数："))
        choice = input("请输入运算符（+ - * / log ** %）")
        if choice == "+":
            print("num1", choice, "num2=", cjia(num1, num2))
        elif choice == "-":
            print("num1", choice, "num2=", cjian(num1, num2))
        elif choice == "*":
            print("num1", choice, "num2=", ccheng(num1, num2))
        elif choice == "/":
            print("num1", choice, "num2=", cchu(num1, num2))
        elif choice == "log":
            print("log以", num1, "为底，", num2,"的对数=",cduishu(num1, num2))
        elif choice == "%":
            print("num1", choice, "num2=", cqiuyu(num1, num2))
        elif choice == "**":
            print("num1的", choice, "num2次方=", cchengfang(num1, num2))
        conti = input("是否继续？Y/N")
        if conti == "Y" or conti == "y":
            flag = True
        else:
            flag = False
    elif yunsuan=="2":
        num1= int(input("请输入一个数："))
        num2=int(input("请输入另一个数："))
        choice = input("请输入运算符（+ - * / log ** %）")
        if choice=="+":
            print("num1",choice,"num2=",cjia(num1,num2))
        elif choice == "-":
            print("num1", choice, "num2=", cjian(num1, num2))
        elif choice=="*":
            print("num1",choice,"num2=",ccheng(num1,num2))
        elif choice=="/":
            print("num1",choice,"num2=",cchu(num1,num2))
        elif choice == "log":
            print("log以", num1, "为底，", num2,"的对数=",cduishu(num1, num2))
        elif choice == "%":
            print("num1", choice, "num2=", cqiuyu(num1, num2))
        elif choice == "**":
            print("num1的num2次方=", cchengfang(num1, num2))
        conti=input("是否继续？Y/N")
        if conti == "Y" or conti== "y" :
            flag=True
        else:
            flag=False
    elif yunsuan=="3":
        sanjiao = input("请输入运算种类：")
        num = float(input("请输入角度值："))
        csanjiao(sanjiao,num)
        conti = input("是否继续？Y/N")
        if conti == "Y" or conti == "y":
            flag = True
        else:
            flag = False